import { guid } from "share/common";
import { State as ProductListState } from 'components/productList/control';
import { State as HTMLControlState } from 'components/html/control';

let templates: PageData[] = [
    {
        id: `2CD52FAD-AA6A-4FEE-960F-67111EE620BC`,
        controls: [
            {
                controlId: guid(), controlName: 'html', position: 'view',
                selected: 'disabled', save: false, data: {
                    html: `<h3 class="text-center" style="margin-top:200px;">空白模板</h3>`
                } as HTMLControlState
            }
        ]
    },
    {
        id: `3A28E7C5-D0A9-4248-847D-EFC58DE643A3`,
        controls: [
            viewControl('summaryHeader'),
            viewControl('productList', {
                productsCount: 6
            } as ProductListState),
        ]
    },
    {
        id: `AD57D915-DD55-4681-A6C4-6402C1544884`,
        controls: [
            headerControl('locationBar'),
            viewControl('productList', {
                productsCount: 6,
                listType: 'singleColumn'
            } as ProductListState),
            footerControl('shoppingCartBar')
        ]
    }
]

function viewControl(controlName: string, data?: any, save?: boolean): ControlData {
    return {
        controlId: guid(),
        controlName,
        position: 'view',
        data,
        save,
    }
}

function footerControl(controlName: string): ControlData {
    return {
        controlId: guid(),
        controlName,
        position: 'footer'
    }
}

function headerControl(controlName: string): ControlData {
    return {
        controlId: guid(),
        controlName,
        position: 'header'
    }
}


export default templates;